﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HOOMT
{
    public class Method
    {
        
        public Method(String accessModifier, String returnType, String methodName, String parameterList, String description = "")
        {


            this.accessModifier = accessModifier;
            this.returnType = returnType;
            this.methodName = methodName;
            this.parameterList = parameterList;
            this.description = description;
            this.id = System.Guid.NewGuid().ToString();
        }

        public Method(String accessModifier, String returnType, String methodName, String parameterList, String id,String description = "")
        {
            this.accessModifier = accessModifier;
            this.returnType = returnType;
            this.methodName = methodName;
            this.parameterList = parameterList;
            this.description = description;
            this.id = id;
        }

        public String AccessModifier
        {
            get
            {
                return accessModifier;
            }
            set
            {
                accessModifier = value;
            }
        }
        public String ReturnType
        {
            get
            {
                return returnType;
            }
            set
            {
                returnType = value;
            }
        }
        public String MethodName
        {
            get
            {
                return methodName;
            }
            set
            {
                methodName = value;
            }
        }
        public String ParameterList
        {
            get
            {
                return parameterList;
            }
            set
            {
                parameterList = value;
            }
        }
        public String Description
        {
            get
            {
                return description;
            }
            set
            {
                description = value;
            }
        }
        public override string ToString()
        {
            return accessModifier + "  " + returnType + "  " + methodName + "(" + parameterList + ");" + "  " + description;//两空格分开
        }
        public String getShowString()
        {
            String showStr = "";
            switch (accessModifier)
            {
                case "public":
                    showStr = "+";
                    break;
                case "private":
                    showStr = "-";
                    break;
                case "protected":
                    showStr = "#";
                    break;
                default:
                    showStr = "";
                    break;
            }
            return showStr + "  " + returnType + "  " + methodName + "()";
        }
        //************************************************************************************

        private String accessModifier;
        private String returnType;
        private String methodName;
        private String parameterList;
        private String description;
        public String id;
    }
}
